package com.locator.view;

import com.locator.R;
import com.locator.services.CallListenerService;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

public class MainScreen extends Activity {
    /** Called when the activity is first created. */
	Button tabsButton, startButton, stopButton;
	
	 private OnClickListener startServiceListener = new OnClickListener() {       
	        @Override
	        public void onClick(View arg0) {
	            startService(new Intent(arg0.getContext(), CallListenerService.class));
	            findViewById(R.id.imageView1).setBackgroundResource(R.drawable.call_locator_screen_active);
	     
	        }
	    };
	    private OnClickListener stopServiceListener = new OnClickListener() {
	        @Override
	        public void onClick(View arg0) {
	            stopService(new Intent(arg0.getContext(), CallListenerService.class));
	            findViewById(R.id.imageView1).setBackgroundResource(R.drawable.call_locator_screen);
	        }
	    };
	    
	    private OnClickListener getDailyView =  new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				
				Intent myIntent = new Intent(v.getContext(), TabsScreen.class);
				startActivityForResult(myIntent, 0);
				
			}
		};
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    	//requestWindowFeature(Window.FEATURE_NO_TITLE);
    	//getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSREEN);
        setContentView(R.layout.main);
        
        tabsButton=(Button)findViewById(R.id.button1);
        startButton = (Button) findViewById(R.id.button2);
        stopButton = (Button) findViewById(R.id.button3);
        
        tabsButton.setOnClickListener(getDailyView);
        startButton.setOnClickListener(this.startServiceListener);
        stopButton.setOnClickListener(this.stopServiceListener);
        
        
    }
}